exports.isAttention = function(req, res) {

	//获取restful参数
	var bdoyParams = req.routeInfo.bodyParams;

	//最终反回结果
	var resultData = {};

	//保存access_token
	var accessToken = "";

	//保存jsapi_ticket
	var jsapiTicket = "";

	//任务流创建
	async.waterfall([

		//获取accessToken
		function(cb) {

			R.SEND_HTTP(
				req, {
					url: "http://"+config.publicConfig.SERVER_IP+":3400/weixin/getAccessToken",
//					url: "http://demo2.artmofang.com:3400/weixin/getAccessToken",
//					url: config.publicConfig.MIDDLE_API_SERVER + "weixin/getAccessToken",
					method: 'GET'
				},
				function(err, data) {

					if(err) {
						return RES.response(res, false, "获取accessToken失败");
					}

					access_token = data.access_token;
					//console.log("access_token:" + access_token);

					cb();

				}
			);

		},

		//是否关注
		function(cb) {

			R.SEND_HTTP(
				req, {
					url: "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" + access_token + "&openid=" + bdoyParams.openid + "&lang=zh_CN",
					method: 'GET'
				},
				function(err, data) {

					//console.log('是否关注');
					//console.log(data);

					//判断是否请求成功
					if(data.subscribe == 0) {
						resultData.guanzhu = false;
					}

					resultData.guanzhu = true;

					cb();

				}
			);

		},

	], function(err, result) {
		//console.log('最终结果：')
		//console.log(resultData)
		//返回最终拼接结果
		RES.response(res, true, resultData);

	});

}